//
//  Student.m
//  OC2_方法
//
//  Created by dllo on 15/10/23.
//  Copyright (c) 2015年 dllo. All rights reserved.
//

#import "Student.h"
//#import "A"       // 如果要#import一个.h文件,在.m里写
@implementation Student

- (id)init
{
_name = @"王宁";
    _sex = @"男";
    _age = 22;
    _score = 99.9;
    return self;

}

- (NSString *)name;
{
    
    return _name;
    
}

- (void)setName:(NSString *)name
{

    _name = name;

}

- (NSString *)sex
{
    return _sex;
}

- (void)setSex:(NSString *)sex
{
    _sex = sex;
}

- (NSInteger)age
{
    return _age;
}

-(void)setAge:(NSInteger)age
{
    _age = age;
}

-(CGFloat)score
{
    return _score;
}

-(void)setScore:(CGFloat)score
{
    _score = score;
}

- (void)sumWithNum1:(NSInteger)num1 num2:(NSInteger)num2
{

    NSInteger sum = num1 + num2;
    NSLog(@"%ld", sum);

}
// 方法前面如果写'+',这个方法只能被类调用
// 方法前面如果写'-',这个方法只能被对象调用
-(id)initWithName:(NSString *)name sex:(NSString *)sex age:(NSInteger)age score:(CGFloat)score
{

    _name = name;
    _score = score;
    _sex = sex;
    _age = age;
    return self;

}





-(void)info
{

    NSLog(@"%@ %@ %ld %.2f", _name, _sex, _age, _score);

}





@end
